﻿using XmlStudio.Interfaces;

namespace XmlStudio.Models {
    /// <summary>
    /// Factory for models.
    /// </summary>
    public static class ModelFactory {
        /// <summary>
        /// Creates new xml xmlModel.
        /// </summary>
        /// <returns>Reference to <see cref="IXmlModel"/>.</returns>
        public static IXmlModel CreateXmlModel() {
            return new XmlModel();
        }

        /// <summary>
        /// Creates new xsd xmlModel.
        /// </summary>
        /// <returns>Reference to <see cref="IXsdModel"/>.</returns>
        public static IXsdModel CreateXsdModel() {
            return new XsdModel();
        }

        /// <summary>
        /// Creates new xml xmlModel with path specified.
        /// </summary>
        /// <param name="path">Path to the document to open.</param>
        /// <returns>Reference to <see cref="IXmlModel"/>.</returns>
        public static IXmlModel CreateXmlModel(string path) {
            var model = new XmlModel();
            model.Open(path);
            return model;
        }

        /// <summary>
        /// Creates new xsd xmlModel with path specified.
        /// </summary>
        /// <param name="path">Path to the document to open.</param>
        /// <returns>Reference to <see cref="IXsdModel"/>.</returns>
        public static IXsdModel CreateXsdModel(string path) {
            var model = new XsdModel();
            model.Open(path);
            return model;
        }
    }
}